package sparrowGui.skin
{
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;

	/**
	 * 树形条项的皮肤
	 * @author Administrator
	 * 
	 */	
	public class TreeItemSkin extends RadioItemSkin
	{
		public function TreeItemSkin()
		{
			super();
		}
		
		override protected function init():void
		{
			var txt:TextField = new TextField();
			upState = new Sprite();
			drawShap(upState,3);
			txt.x = 18;
			txt.autoSize = TextFieldAutoSize.LEFT;
			upState.addChild(txt);
			upState.name = "upState";
			
			selectState = new Sprite();
			txt = new TextField();
			draw2(selectState,3);
			txt.x = 18;
			txt.autoSize = TextFieldAutoSize.LEFT;
			selectState.addChild(txt);
			txt.textColor = 0x333333;
			selectState.name = "selectState";
			
			overState = new Sprite();
			txt = new TextField();
			drawShap(overState,3,6,0x59859F,0xDDDDDD);
			txt.x = 18;
			txt.autoSize = TextFieldAutoSize.LEFT;
			overState.addChild(txt);
			overState.name = "overState";
			
			downState = new Sprite();
			txt = new TextField();
			drawShap(downState,3,6,0x59859F,0xDBF6F8);
			txt.x = 18;
			txt.autoSize = TextFieldAutoSize.LEFT;
			downState.addChild(txt);
			downState.name = "downState";
			
			hitTestState = null;
		}
		
		override protected function drawShap(sp:Sprite, txy:int, r:int=6, borderColor:int=0x666666, bgColor:int=0xCCCCCC):void
		{
			sp.graphics.beginFill(bgColor);
			sp.graphics.drawRect((txy),(txy+r-2),r*2,4);
			sp.graphics.endFill();
			sp.graphics.beginFill(bgColor);
			sp.graphics.drawRect((txy+r-2),(txy),4,r*2);
			sp.graphics.endFill();
		}
		
		protected function draw2(sp:Sprite, txy:int, r:int=6, bgColor:int=0xCCCCCC):void
		{
			sp.graphics.beginFill(bgColor);
			sp.graphics.drawRect((txy),(txy+r-2),r*2,4);
			sp.graphics.endFill();
		}
	}
}